<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
		<script type="text/javascript" src="../../js/boot.js"></script>
		<title></title>
	</head>

	<body>
		<div class="mini-toolbar" style="text-align:center;line-height:30px;" borderStyle="border:0;">
			<label>项目名称：</label>
			<input id="projectID" name="projectID" class="mini-combobox" textField="projectName" valueField="projectID">
			<label>姓名：</label>
			<input id="txtUserID" class="mini-autocomplete" popupWidth="120" textField="userName" valueField="userID" style="width: 120px" />
			<label>图纸名称：</label>
			<input id="drawName" class="mini-textbox" />
			<a class="mini-button" style="width:60px;" onclick="search()">查询</a>
		</div>
		<div class="mini-fit">

			<div id="grid1" class="mini-datagrid" style="width:100%;height:100%;" idField="tableID" allowResize="true" borderStyle="border-left:0;border-right:0;" onrowdblclick="onRowDblClick">
				<div property="columns">
					<div type="indexcolumn"></div>
					<div field="drawNo" width="120" headerAlign="center" allowSort="true">图纸编号</div>
					<div field="drawName" width="160" headerAlign="center" allowSort="true">图纸名称</div>
					<div field="userName" width="40" headerAlign="center" allowSort="true">用户姓名</div>
				</div>
			</div>

		</div>
		<div class="mini-toolbar" style="text-align:center;padding-top:8px;padding-bottom:8px;" borderStyle="border:0;">
			<a class="mini-button" style="width:60px;" onclick="onOk()">确定</a>
			<span style="display:inline-block;width:25px;"></span>
			<a class="mini-button" style="width:60px;" onclick="onCancel()">取消</a>
		</div>

	</body>

	<script type="text/javascript">
		miniInit();

		var txtUserID = mini.get("txtUserID");
		txtUserID.setName("userID");
		txtUserID.set({
			url: http.getUrl("/user/page.do")
		});

		var txtDrawName = mini.get("drawName");
		
		// 项目名称控件数据
		var projectCombox = mini.get("projectID");
		var projectUrl = "/oa/project/project/list.do?tstatus=1";
		http.get(projectUrl, function(page) {
			if(page.data.length > 0) {
				projectCombox.setData(page.data);
			}
		});

		var grid = mini.get("grid1");
		grid.setUrl(http.getUrl("/project/draw/page.do"));
		// grid.load();

		function getData() {
			var row = grid.getSelected();
			return row;
		}

		function search() {
			var drawName = txtDrawName.getValue();
			var userID = txtUserID.getValue();
			var projectID = projectCombox.getValue();
			var data = {};
			if(drawName != "") {
				data.drawName = drawName;
				data.drawName_link = "like";
			}
			if(userID != "") {
				data.userID = userID;
			}
			if(projectID != "") {
				data.projectID = projectID;
			}
			grid.load(data);
		}

		function onKeyEnter(e) {
			search();
		}

		function onRowDblClick(e) {
			onOk();
		}

		function CloseWindow(action) {
			if(window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
			else window.close();
		}

		function onOk() {
			CloseWindow("ok");
		}

		function onCancel() {
			CloseWindow("cancel");
		}
	</script>

</html>